home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
2207
/
2207.xpi
/
chrome
/
cooliris.jar
/
content
/
cooliris
/
webcontrol.js
< prev
next >
Wrap
Text File
|
2010-01-28
|
5KB
|
184 lines
function cooliris_wc_clsWebControl(_1,_2,_3,_4){
this.obj=_1;
this.startPoint=_2;
this.endPoint=_3;
this.callback=null;
this.type=_4;
this.stop=false;
}
cooliris_wc_clsWebControl.prototype={animTimer:null,animDelay:10,numTimes:50,xChange:0,yChange:0,maxTimes:20,startDim:null,endDim:null,setDim:function(_5,_6){
this.startDim=_5;
this.endDim=_6;
},magnify:function(){
var _7=this;
if(this.animTimer==null){
this.numTimes=this.maxTimes;
this.wChange=(this.endDim.width-this.startDim.width)/this.numTimes;
this.hChange=(this.endDim.height-this.startDim.height)/this.numTimes;
this.xChange=(this.endPoint.left-this.startPoint.left)/this.numTimes;
this.yChange=(this.endPoint.top-this.startPoint.top)/this.numTimes;
}
this.startDim.width+=this.wChange;
this.startDim.height+=this.hChange;
this.startPoint.left+=this.xChange;
this.startPoint.top+=this.yChange;
this.obj.style.position="fixed";
if(this.callback!=null){
this.callback(this.startPoint.left,this.startPoint.top,this.startDim.width,this.startDim.height);
}
this.numTimes--;
if(this.numTimes<5){
this.animDelay+=10;
}
this.animTimer=setTimeout(function(){
_7.magnify();
},this.animDelay);
if(this.numTimes==0){
this.reset(cooliris_wc_EffectType.ANIMATE);
this.obj.style.width=this.endDim.width;
this.obj.style.height=this.endDim.height;
this.obj.style.left=this.endPoint.left;
this.obj.style.top=this.endPoint.top;
}
},magnifyStack:function(){
if(this.stop){
return;
}
var _8=this;
if(this.animTimer==null){
this.numTimes=this.maxTimes;
this.wChange=(this.endDim.width-this.startDim.width)/this.numTimes;
this.hChange=(this.endDim.height-this.startDim.height)/this.numTimes;
this.xChange=(this.endPoint.left-this.startPoint.left)/this.numTimes;
this.yChange=(this.endPoint.top-this.startPoint.top)/this.numTimes;
}
this.startDim.width+=this.wChange;
this.startDim.height+=this.hChange;
this.obj.style.width=this.startDim.width+"px";
this.obj.style.height=this.startDim.height+"px";
this.startPoint.left+=this.xChange;
this.startPoint.top+=this.yChange;
this.obj.style.left=this.startPoint.left+"px";
this.obj.style.top=this.startPoint.top+"px";
this.obj.style.position="fixed";
this.numTimes--;
if(this.callback!=null){
this.callback(this.numTimes);
}
if(this.numTimes<5){
this.animDelay+=10;
}
this.animTimer=setTimeout(function(){
_8.magnifyStack();
},this.animDelay);
if(this.numTimes==0){
this.reset(cooliris_wc_EffectType.ANIMATE);
this.obj.style.width=this.endDim.width;
this.obj.style.height=this.endDim.height;
this.obj.style.left=this.endPoint.left;
this.obj.style.top=this.endPoint.top;
}
},expand:function(){
var _9=this;
if(this.animTimer==null){
this.numTimes=this.maxTimes;
this.wChange=(this.endDim.width-this.startDim.width)/this.numTimes;
this.hChange=(this.endDim.height-this.startDim.height)/this.numTimes;
}
this.startDim.width+=this.wChange;
this.startDim.height+=this.hChange;
this.obj.style.width=this.startDim.width+"px";
this.obj.style.height=this.startDim.height+"px";
this.obj.style.position="fixed";
if(this.callback!=null){
this.callback(this.endPoint.left,this.endPoint.top,this.startDim.width,this.startDim.height);
}
this.numTimes--;
if(this.numTimes<5){
this.animDelay+=10;
}
this.animTimer=setTimeout(function(){
_9.expand();
},this.animDelay);
if(this.numTimes==0){
this.reset(cooliris_wc_EffectType.ANIMATE);
this.obj.style.width=this.endDim.width;
this.obj.style.height=this.endDim.height;
if(this.endCallback!=null){
this.endCallback(this.endPoint.left,this.endPoint.top,this.startDim.width,this.startDim.height);
}
}
},fadeIn:function(){
var _a=this;
if(this.animTimer==null){
this.numTimes=this.maxTimes;
this.opacityChange=(1-0.1)/this.numTimes;
this.obj.style.opacity=0;
}
var _b=this.obj.style.opacity;
_b=parseFloat(_b)+this.opacityChange;
this.obj.style.opacity=_b;
this.numTimes--;
if(this.numTimes<5){
this.animDelay+=10;
}
this.animTimer=setTimeout(function(){
_a.fadeIn();
},this.animDelay);
if(this.numTimes==0){
this.reset(cooliris_wc_EffectType.ANIMATE);
}
},animate:function(){
var _c=this;
if(this.animTimer==null){
this.numTimes=this.maxTimes;
this.xChange=(this.endPoint.left-this.startPoint.left)/this.numTimes;
this.yChange=(this.endPoint.top-this.startPoint.top)/this.numTimes;
}
this.startPoint.left+=this.xChange;
this.startPoint.top+=this.yChange;
this.obj.style.left=this.startPoint.left+"px";
this.obj.style.top=this.startPoint.top+"px";
this.obj.style.position="fixed";
this.numTimes--;
if(this.numTimes<5){
this.animDelay+=10;
}
this.animTimer=setTimeout(function(){
_c.animate();
},this.animDelay);
if(this.numTimes==0){
this.reset(cooliris_wc_EffectType.ANIMATE);
this.obj.style.left=this.endPoint.left;
this.obj.style.top=this.endPoint.top;
}
},drag:function(){
},reset:function(_d){
switch(_d){
case cooliris_wc_EffectType.ANIMATE:
this.numTimes=this.maxTimes;
clearTimeout(this.animTimer);
this.animTimer=null;
this.animDelay=100;
break;
}
},setObject:function(_e,_f,_10,_11){
this.obj=_e;
this.startPoint=_f;
this.endPoint=_10;
this.type=_11;
}};
function cooliris_wc_Point(_12,top){
this.left=_12;
this.top=top;
var _14=document.getElementById("content");
this.bottom=(_14.boxObject.y+_14.boxObject.height)-this.top;
this.right=(_14.boxObject.x+_14.boxObject.width)-this.left;
}
function cooliris_wc_Dim(_15,_16){
this.width=_15;
this.height=_16;
}
var cooliris_wc_EffectType={ANIMATE:"0",DRAG:"drag",RESIZE:"resize",EXPAND:"expand"};